package org.dromara.system.api.feign;

import org.dromara.common.core.domain.R;
import org.dromara.system.api.feign.fallback.SystemDataScopeFallBack;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import static org.dromara.common.core.constant.ServerNameConstants.SYSTEM_SERVER_NAME;

/**
 * @author: zhou shuai
 * @date: 2024/10/5 22:03
 * @version: v1
 */
@FeignClient(contextId = "system-dataScope-api", name = SYSTEM_SERVER_NAME, fallbackFactory = SystemDataScopeFallBack.class)
public interface SystemDataScopeClient {

    /**
     * 获取角色自定义权限语句
     *
     * @param roleId 角色ID
     * @return 返回角色的自定义权限语句，如果没有找到则返回 null
     */
    @GetMapping(value = "/api/system/data/scope/role/custom")
    R<String> getRoleCustom(@RequestParam("roleId") Long roleId);

    /**
     * 获取部门和下级权限语句
     *
     * @param deptId 部门ID
     * @return 返回部门及其下级的权限语句，如果没有找到则返回 null
     */
    @GetMapping(value = "/api/system/data/scope/dept/pers")
    R<String> getDeptAndChild(@RequestParam("deptId") Long deptId);

}
